#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
//void reserve(int* arr, int head, int tail)
//{
//    while (head < tail)
//    {
//        int tmp = arr[head];
//        arr[head] = arr[tail];
//        arr[tail] = tmp;
//        head++;
//        tail++;
//    }
//}
//
//void rotate(int* nums, int numsSize, int k) {
//    reserve(nums, 0, numsSize - 1);
//    reserve(nums, 0, k - 1);
//    reserve(nums, k, numsSize - 1);
//}
//int main()
//{
//    int arr[] = { 1,2,3,4,5,6,7 };
//    int k = 0;
//    scanf("%d", &k);
//    rotate(arr, 7, k);
//    for (int i = 0; i < 7; i++)
//    {
//        printf("%d ", arr[i]);
//    }
//	return 0;
//}

int countOperations(int num1, int num2) {
    int count = 0;
    while (num1 != 0 && num2 != 0)
    {
        num1 > num2 ? (num1 = num1 - num2) : (num2 = num2 - num1);
        count++;
    }
    return count;
}
int main()
{
    int num1 = 0, num2 = 0;
    scanf("%d%d", &num1, &num2);
    int count = countOperations(num1, num2);
    printf("%d", count);
    return 0;
}